<%--
  Created by IntelliJ IDEA.
  User: 22240
  Date: 2022/5/14
  Time: 22:43
  To change this template use File | Settings | File Templates.
--%>
<%@page import="com.qf.emp.entity.Profile" %>
<%@page import="com.qf.emp.entity.Page" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>查询分页列表</title>
</head>
<body>
    <table border="1">
        <tr>
            <td>编号</td>
            <td>姓名</td>
            <td>工资</td>
            <td>年龄</td>
            <td colspan="2">操作</td>
        </tr>
        <c:forEach var="per" items="${pers}">
            <tr>
                <td>${per.id}</td>
                <td>${per.name}</td>
                <td>${per.birthday}</td>
                <td>${per.gender}</td>
                <td>${per.career}</td>
                <td>${per.address}</td>
                <td>${per.mobile}</td>
                <td>${per.picture}</td>
                <td><a href="<c:url context='${pageContext.request.contextPath}' value='/profile?method=showDetail&id=${per.id}'></c:url>">明细</a></td>
                <td><a href="<c:url context='${pageContext.request.contextPath}' value='update.jsp'></c:url>">修改</a></td>
            </tr>
        </c:forEach>
            <tr>
                <td colspan="6">
<%--                首页--%>
                    <a href="<c:url context='${pageContext.request.contextPath}' value='/profile?method=show&pageIndex=1' />">首页</a>
<%--                上一页--%>
                    <c:if test="${page.pageIndex >1}">
                        <a href="<c:url context='${pageContext.request.contextPath}' value='/profile?method=show&pageIndex=${page.pageIndex - 1}' />">上一页</a>
                    </c:if>
                    <c:if test="${page.pageIndex ==1}">
                        <a>上一页</a>
                    </c:if>
<%--                下一页--%>
                    <c:if test="${page.pageIndex < page.totalPages}">
                        <a href="<c:url context='${pageContext.request.contextPath}' value='/profile?method=show&pageIndex=${page.pageIndex + 1}' />">下一页</a>
                    </c:if>
                    <c:if test="${page.pageIndex == page.totalPages}">
                        <a>下一页</a>
                    </c:if>
<%--                尾页--%>
                    <a href="<c:url context='${pageContext.request.contextPath}' value='/profile?method=show&pageIndex=${page.totalPages}' />">尾页</a>
                </td>
            </tr>
    </table>
</body>
</html>
